const axios = require('axios')
const constants = require('./constants')

const service = axios.create({
    baseURL: constants.baseApi,
    timeout: 60 * 1000
})

service.interceptors.request.use(
    config => {
        return config
    },
    error => {
        Promise.reject(error)
    }
)

service.interceptors.response.use(response => {
    return response.data
}, (err => {
    return Promise.reject(err)
}))

module.exports = service